<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.*" %>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import ="ee.tallink.beans.*" %>
<jsp:useBean id="accounts" scope="application" class="ee.tallink.beans.Accounts"/>  

<html>
<head>
<style>
body, td {font-family:verdana;font-size:10pt;}
</style>
<script type="text/javascript">

function changeAccount() {
	var selectedItem = document.getElementById("selectedItem");
	var txtCodeObj = document.getElementById('txtCode');
	var re = /(\w+)\s(\w+)/;
	txtCodeObj.value = selectedItem.options[selectedItem.selectedIndex].text.replace(re, "$2") + "";

}
</script>
<title>managers panel</title>
</head>
<body>
		<div align="center">choose manager for room request</div>
	<form name="tlnkForm"
	    action="testaccount"
	    method="GET">
	    <a href="./">back</a></div>
	<div><span></span></div>

<div style="background-color:lightblue; font-family:verdana">	

	<p>
accounts:<select name="selectedItem" id="selectedItem" onchange="changeAccount();">
    <c:forEach items="${accounts.accountsList}" var="item">
        <option value="${item.id}">${item.name}&nbsp;${item.position}</option>
    </c:forEach>
</select>
<br>

	    
<div style="background-color:lightblue; font-family:verdana">	

	<p>

<table width="40%" cellpadding="5" bordercolor="#000066" bgcolor="#FFFFFF" border="1" cellspacing="0">
<tr>
<td>name</td>
<td>managers</td>
</tr> 
    <c:forEach items="${accounts.list}" var="itemc">
    	<tr>
     	<td>${itemc.name}</td>
     	<td>${itemc.position}</td>
		</tr> 
		
    </c:forEach>
 
</table>

<br>
  <% if (request.getAttribute("response") != null) {
    out.print("<b>Response </b><br/>");
    out.print(request.getAttribute("response"));
    out.print("<br/>");
  }%>
<br>
</div>	
	<div>	
	    <input type="hidden" name="action" value="CHECKOUT">
	    <input type="submit" name="Checkout" value="Checkout">
	</div>

</body>
</html>